<?php namespace App\Http\Controllers;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;

use App\Services\Nav as sNav;
use App\Services\Banner as sBanner;
use App\Services\Categories as sCategories;
use App\Models\Banner  as mBanner;
use App\Services\Articel as sArticel;

use Illuminate\Http\Request;

class BaseController extends Controller {

	protected $navs;
	protected $categories;
	protected $banners;
	protected $recommends;

	public function __construct(){

		$this->navs = sNav::getNavList();
		
		$this->categories = sCategories::getCategoriesList();

		$banners  = sBanner::getBanners();

		$this->recommends = sArticel::getRecommendArticel();

		foreach ($banners as $value) {
			$value->img_url = mBanner::UPLOAD_PATH.$value->img_url;
		}

		$this->banners = $banners;
	}

	public function view($view , $data = array() , $mergerData = array()){
		return View::make($view,$data,$mergerData);
	}


	public function redirect($route,$parameters = array(),$status=302,$headers = array()){
		return Redirect::route($route,$parameters,$status,$headers);
	}


}